<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2022/10/11
  Time: 20:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>

    <title>LinkedChat招聘网</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/public/static/css/Headers.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/public/static/css/SearchJob.css">
    <script src="${pageContext.request.contextPath}/public/static/js/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/public/static/layui/css/layui.css">
    <link href="${pageContext.request.contextPath}public/static/images/login_icon.ico" rel="shortcut icon">
    <script src="${pageContext.request.contextPath}/public/static/layui/layui.js"></script>
    <script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/public/static/js/index.js"></script>
    <link href="${pageContext.request.contextPath}/public/static/images/login_icon.ico" rel="shortcut icon">
</head>
<body>


<!--头部-->
<div id="header">
    <%--    <div class="header_i">--%>
    <%--        <!--logo-->--%>
    <%--        <a href="#">--%>
    <%--            <div class="logo">--%>
    <%--                <span>LinkedChat</span>--%>
    <%--            </div>--%>
    <%--        </a>--%>
    <%--        <!--nav-->--%>
    <%--        <div class="nav">--%>
    <%--            <ul >--%>
    <%--                <li class="menu_item"><a href="">首页</a></li>--%>
    <%--                <li class="menu_item"><a href="${pageContext.request.contextPath}/public/Job/SearchJob.jsp">职位</a></li>--%>
    <%--                <li class="menu_item"><a href="">校园</a></li>--%>
    <%--                <li class="menu_item"><a href="">海归</a></li>--%>
    <%--                <li class="menu_item"><a href="${pageContext.request.contextPath}/public/Company/CompanyHomePage.html">公司</a></li>--%>
    <%--                <li class="menu_item"><a href="">APP</a></li>--%>
    <%--                <li class="menu_item"><a href="">咨询</a></li>--%>
    <%--                <li class="menu_item"><a href="">百科</a></li>--%>
    <%--            </ul>--%>
    <%--        </div>--%>

    <%--        <!--登录区域  -->--%>
    <%--        <div class="login_info" style="display: block">--%>
    <%--            <div class="head_msg">--%>
    <%--                <a href="" class="drop_trigger">--%>
    <%--                    <ul >--%>
    <%--                        <li class="menu_item">上传简历</li>--%>
    <%--                        <li class="menu_item">我要找工作</li>--%>
    <%--                    </ul>--%>
    <%--                </a>--%>

    <%--            </div>--%>
    <%--            <div class="head_user">--%>
    <%--                <a href="${pageContext.request.contextPath}/public/Person/Login.jsp" class="loginBtn usernameorlogin" >登陆</a>--%>
    <%--                <a href="${pageContext.request.contextPath}/public/Person/Register.jsp" class="loginBtn">注册</a>--%>
    <%--            </div>--%>
    <%--        </div>--%>
    <%--        <div class="login_info1" style="display: none">--%>
    <%--            <ul >--%>
    <%--                <li class="menu_item">--%>
    <%--                    <a href="/GiteeProbject/LinkedChatSystem/Person/Messagers.html" class="header_message">消息--%>
    <%--                        <span class = "message_chat_num"></span>--%>
    <%--                    </a>--%>
    <%--                </li>--%>
    <%--                <li class="menu_item">--%>
    <%--                    <a href="#" class="header_cv">简历</a>--%>
    <%--                </li>--%>
    <%--                <li class="header_figure menu_item">--%>
    <%--                    <a href="#" class="header_username">--%>
    <%--                        <span class="un_text" style="margin-left: 40px"> </span>--%>
    <%--                        <img src="https://img.bosszhipin.com/boss/avatar/avatar_14.png" alt="">--%>
    <%--                    </a>--%>
    <%--                    <div class="dropdown">--%>
    <%--                        <a href="${pageContext.request.contextPath}/public/Person/PersonCenter.jsp" class="person_center" >--%>
    <%--                            个人中心--%>
    <%--                            <span>推荐职位、编辑在线简历</span>--%>
    <%--                        </a>--%>
    <%--                        <a href="${pageContext.request.contextPath}/jsp/backStageLogin.jsp" class="change_recruit">切换为招聘者</a>--%>
    <%--                        <a href="javascript:void(0)" class="logout">退出登陆</a>--%>
    <%--                    </div>--%>
    <%--                </li>--%>
    <%--            </ul>--%>
    <%--        </div>--%>
    <%--    </div>--%>
    <script>
        $(function() {
            $('#header').load('${pageContext.request.contextPath}/public/Person/header.jsp');
        })
    </script>
</div>
<script>
    $(function() {
        $('#header').load('${pageContext.request.contextPath}/public/Person/header.jsp');
    })
</script>



<!--搜索框-->
<div class="serch_body">
    <div class="search_postion">
        <div class="search_konbai"></div>
        <!--左侧下拉菜单-->
        <div class="search_box_select">
            <div class="select_left">
                <select name="">
                    <option value="">技术类型</option>
                    <option value="">Java</option>
                    <option value="">Python</option>
                </select>
            </div>
            <input type="text" name="selectjob" placeholder="搜索职位、公司" id="selectcontent" value="">
            <button  name="selectjobbtn" class="searchbtn">搜索</button>
        </div>
    </div>
</div>

<div class="screen">
    <!--    城市-->
    <div class="screen-city">
        <span class="city">城市</span>
        <ul class="ull">
            <li id="bg1">不限</li>
            <li>全国</li>
            <li>北京</li>
            <li>上海</li>
            <li>广东</li>
            <li>深圳</li>
            <li>苏州</li>
            <li>西安</li>
            <li>其他城市</li>

        </ul>
    </div>
    <!--    区域-->
    <div class="screen-area">
        <span class="area">区域</span>
        <div class="area_select">
            <div class="area_select1">
                <ul class="arealist1">
                    <li class="li1 "id="bg2">不限</li>
                    <li class="li1">苏州工业园区</li>
                    <li class="li1">吴中区</li>
                    <li class="li1">昆山市</li>
                    <li class="li1">姑苏区</li>
                    <li class="li1">虎丘区</li>
                    <li class="li1">相城区</li>
                    <li class="li1">吴江区</li>

                </ul>
            </div>
            <div class="area_select2">
                <!--                <a href="" class="xianshishouqi">显示</a>-->
                <ul class="arealist2">
                    <li class="li2" id="bg3">不限</li>
                    <li class="li2">白塘</li>
                    <li class="li2">李公堤</li>
                    <li class="li2">双塔</li>
                    <li class="li2">车坊</li>
                    <li class="li2">东方之门</li>
                    <li class="li2">东环路</li>
                    <li class="li2">双湖</li>
                    <li class="li2">独墅湖</li>
                    <li class="li2">东沙湖</li>
                    <li class="li2">双湖</li>

                    <li class="li2">湖东</li>
                    <li class="li2">博览中心</li>
                    <li class="li2">邻瑞广场</li>
                    <li class="li2">联丰广场</li>
                    <li class="li2">玲珑</li>
                    <li class="li2">月亮湾</li>
                    <li class="li2">印象城</li>

                </ul>
            </div>
        </div>
    </div>
    <!--    条件筛选-->
    <div class="moreselection">
        <span class="word">筛选</span>
        <select class="companyde" >
            <option >公司行业</option>
            <option >互联网</option>
            <option >计算机</option>
            <option >电商</option>
        </select>

        <select class="degreede">
            <option >学历要求</option>
            <option >本科</option>
            <option >大专</option>
            <option >研究生</option>
            <option >高中及以下</option>
        </select>
        <select class="salaryde">
            <option >薪资待遇</option>
            <option >0-2000</option>
            <option >2000-5000</option>
            <option >5000-8000</option>
            <option >8000-10000</option>
            <option >10000-15000</option>
            <option >15000-50000</option>
        </select>
        <select class="jingyande">
            <option >工作经验</option>
            <option >实习生</option>
            <option >在校生</option>
            <option >经验不限</option>
            <option >1年以内</option>
            <option >1-3年</option>
            <option >3-5年</option>
            <option >5年以上</option>
        </select>
        <select class="companysizede">
            <option >公司规模</option>
            <option >不限</option>
            <option >0-20人</option>
            <option >20-99人</option>
            <option >100-499人</option>
            <option >10000以上</option>

        </select>
        <%--        <select class="rongzide">--%>
        <%--            <option >融资阶段</option>--%>
        <%--            <option >不限</option>--%>
        <%--            <option >未融资</option>--%>
        <%--            <option >天使轮</option>--%>
        <%--            <option >A轮</option>--%>
        <%--            <option >B轮</option>--%>
        <%--            <option >上市</option>--%>
        <%--            <option >不需要融资</option>--%>

        <%--        </select>--%>
        <a class=" queding">确定</a>
        <a class="clearselect clears" href="">清空筛选</a>
    </div>
</div>
<!--内容-->
<div class="content">
    <div class="leftcontent">
        <ul class="leftlist">
            <div class="page1">
                <%--                <c:forEach items="${result.data.list}" var="job">--%>
                <%--                <li class="licontent">--%>
                <%--                    <a href="${pageContext.request.contextPath}/job/getById/${job.jobDetail.jobId}" class="content_a">--%>
                <%--                        <div class="job_card">--%>
                <%--                            <div class="line1">--%>
                <%--&lt;%&ndash;                                <input type="hidden" class="result_jobId" value="${job.jobDetail.jobId}">&ndash;%&gt;--%>
                <%--                                <span class="line1_span1">${job.jobDetail.jobName}</span>--%>
                <%--                                <span class="line1_span2">苏州${job.jobDetail.jobLocArea}</span>--%>
                <%--                            </div>--%>
                <%--                            <div class="line2">--%>
                <%--                                <span class="line2_span1">--%>
                <%--                        <fmt:formatNumber value="${job.jobDetail.jobMinSalary}" type="currency" pattern="￥"/>--%>
                <%--                                    ---%>
                <%--                        <fmt:formatNumber value="${job.jobDetail.jobMaxSalary}" type="currency" pattern="￥"   />--%>

                <%--                                </span>--%>
                <%--                                <span class="line2_span2">${job.jobDetail.jobExperience}</span>--%>
                <%--                                <span class="line2_span3">${job.jobDetail.jobDegree}</span>--%>
                <%--                            </div>--%>

                <%--                        </div>--%>
                <%--                        <div class="company_card">--%>
                <%--                            <img src="${pageContext.request.contextPath}/public/static/images/selectjob_pic.png" alt="" style="width: 54px">--%>
                <%--                            <a href="" class="right_line1">${job.companyDetail.companyName}</a>--%>
                <%--                            <ul class="right_line2">--%>
                <%--                                <li class="right_linecontent right_line21">${job.companyDetail.companyIndustry}</li>--%>
                <%--                                <li class="right_linecontent right_line22">${job.companyDetail.companyFinance}</li>--%>
                <%--                                <li class="right_linecontent right_line23">${job.companyDetail.companyScale}</li>--%>
                <%--                            </ul>--%>
                <%--                        </div>--%>
                <%--                        <div class="content_li_footer">--%>
                <%--                            <div class="footer_left">--%>
                <%--                                <ul class="f">--%>
                <%--                                    <li class="f1">${job.jobDetail.jobType}</li>--%>
                <%--                                    <li class="f1"></li>--%>
                <%--                                    <li class="f1"></li>--%>
                <%--                                </ul>--%>
                <%--                            </div>--%>
                <%--                            <span class="footer_right" title="五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补">--%>
                <%--                            五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补--%>
                <%--                        </span>--%>
                <%--                        </div>--%>
                <%--                    </a>--%>
                <%--                </li>--%>
                <%--                </c:forEach>--%>
            </div>




        </ul>
    </div>
    <div class="content_right">
        <img class="searchjobpic" src="${pageContext.request.contextPath}/public/static/images/searchjob_piclogo.webp" style="width: 300px" alt="">
        <div class="search_otherlook">
            <span class="otherlookword">看过的职位</span>
            <ul class="otherlookbox">
                <%--                <li class="boxcontent">--%>
                <%--                    <a href="" class="boxcon">--%>
                <%--                        <div class="otherlookbox1">--%>
                <%--                            <span class="otherbox1_left">java开发工程师（五险一金，不加班）</span>--%>
                <%--                            <span class="otherbox1_right">10-15K·13薪</span>--%>
                <%--                        </div>--%>
                <%--                        <div class="otherlookbox2">--%>
                <%--                            <span class="otherbox2_left">安徽尚华电子科技...</span>--%>
                <%--                            <span class="otherbox2_right">苏州·苏州工业园区</span>--%>
                <%--                        </div>--%>
                <%--                    </a>--%>
                <%--                </li>--%>
                <%--                <li class="boxcontent">--%>
                <%--                    <a href="" class="boxcon">--%>
                <%--                        <div class="otherlookbox1">--%>
                <%--                            <span class="otherbox1_left">java开发工程师（五险一金，不加班）</span>--%>
                <%--                            <span class="otherbox1_right">10-15K·13薪</span>--%>
                <%--                        </div>--%>
                <%--                        <div class="otherlookbox2">--%>
                <%--                            <span class="otherbox2_left">安徽尚华电子科技...</span>--%>
                <%--                            <span class="otherbox2_right">苏州·苏州工业园区</span>--%>
                <%--                        </div>--%>
                <%--                    </a>--%>
                <%--                </li>--%>
                <%--                <li class="boxcontent">--%>
                <%--                    <a href="" class="boxcon">--%>
                <%--                        <div class="otherlookbox1">--%>
                <%--                            <span class="otherbox1_left">java开发工程师（五险一金，不加班）</span>--%>
                <%--                            <span class="otherbox1_right">10-15K·13薪</span>--%>
                <%--                        </div>--%>
                <%--                        <div class="otherlookbox2">--%>
                <%--                            <span class="otherbox2_left">安徽尚华电子科技...</span>--%>
                <%--                            <span class="otherbox2_right">苏州·苏州工业园区</span>--%>
                <%--                        </div>--%>
                <%--                    </a>--%>
                <%--                </li>--%>
                <%--                <li class="boxcontent">--%>
                <%--                    <a href="" class="boxcon">--%>
                <%--                        <div class="otherlookbox1">--%>
                <%--                            <span class="otherbox1_left">java开发工程师（五险一金，不加班）</span>--%>
                <%--                            <span class="otherbox1_right">10-15K·13薪</span>--%>
                <%--                        </div>--%>
                <%--                        <div class="otherlookbox2">--%>
                <%--                            <span class="otherbox2_left">安徽尚华电子科技...</span>--%>
                <%--                            <span class="otherbox2_right">苏州·苏州工业园区</span>--%>
                <%--                        </div>--%>
                <%--                    </a>--%>
                <%--                </li>--%>
                <%--                <li class="boxcontent">--%>
                <%--                    <a href="" class="boxcon">--%>
                <%--                        <div class="otherlookbox1">--%>
                <%--                            <span class="otherbox1_left">java开发工程师（五险一金，不加班）</span>--%>
                <%--                            <span class="otherbox1_right">10-15K·13薪</span>--%>
                <%--                        </div>--%>
                <%--                        <div class="otherlookbox2">--%>
                <%--                            <span class="otherbox2_left">安徽尚华电子科技...</span>--%>
                <%--                            <span class="otherbox2_right">苏州·苏州工业园区</span>--%>
                <%--                        </div>--%>
                <%--                    </a>--%>
                <%--                </li>--%>

            </ul>
        </div>
        <img class="search_pic1" src="${pageContext.request.contextPath}/public/static/images/jobdetail_guanggao1png.png" style="width: 300px">
        <img class="search_pic1" src="${pageContext.request.contextPath}/public/static/images/jobdetail_guanggao2.jpg" style="width: 300px">
    </div>
</div>

<div id="demo2" class="demo2"></div>
<script src="${pageContext.request.contextPath}/public/static/js/SearchJob.js"></script>

<script>
    // var degree=degreede();
    // var companyde=xiala();
    // var salaryde=salaryde();
    // var jingyande=jingyande();
    // var companysizede=companysizede();
    // var rongzide =rongzide();
    var token=localStorage.getItem("token")
    localStorage.setItem("token",token)
    var degree=degrees();
    var companyde=xiala();
    var salaryde=salarys();
    var jingyande=jingyans();
    var companysizede=companysizes();
    // var rongzide =rongzis();


    console.log("degree"+degree)
    console.log("companyde"+companyde)
    console.log("salaryde"+salaryde)
    console.log("jingyande"+jingyande)
    console.log("companysizede"+companysizede)
    // console.log("rongzide"+rongzide)




    selectJob();
    function selectJob(){
        $(".searchbtn").click(function (){
            var name = $("#selectcontent").val();
            if (name!=null||name!="")
            {
                $.ajax({
                    type:"post",
                    url:"${pageContext.request.contextPath}/job/getConfuseNum",
                    data:{kw:name},
                    success:function (result){
                        var allnum=result.data
                        layui.use(['laypage', 'layer'], function(){
                            var laypage = layui.laypage
                                ,layer = layui.layer;
                            laypage.render({
                                elem: 'demo2'
                                ,count: allnum
                                ,limit: 7
                                ,theme: '#76f5e2'
                                ,jump: function(obj, first){

                                    //obj包含了当前分页的所有参数，比如：
                                    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                                    console.log(obj.limit); //得到每页显示的条数
                                    console.log("-----职位信息显现-----")
                                    $.ajax({
                                        type:"post",
                                        url:"${pageContext.request.contextPath}/job/getConfuseJob/"+obj.curr,
                                        data:{
                                            kw:name
                                        },
                                        success:function (result){
                                            console.log("result   "+JSON.stringify(result));
                                            var out=result.data;
                                            var pageNum=out.pageNum
                                            console.log("pageNum"+pageNum)
                                            console.log("out  "+out);
                                            var total=out.total
                                            console.log("查询的总职位数"+total)
                                            var list=out.list
                                            console.log(list.length)
                                            $(".page1").html("")
                                            for (var i=0;i<list.length;i++) {
                                                var jobId = list[i].jobId
                                                var jobName = list[i].jobName
                                                var jobType = list[i].jobType
                                                var companyImg=list[i].companyImg
                                                var companyId = list[i].companyId
                                                var jobDegree = list[i].jobDegree
                                                var jobMaxSalary = Math.floor(list[i].jobMaxSalary)
                                                var jobExperience = list[i].jobExperience
                                                var jobMinSalary = Math.floor(list[i].jobMinSalary)
                                                // var jobLabel=jobDetail.jobLabel
                                                // var jobLocProvince=jobDetail.jobLocProvince
                                                // var jobLocCity=jobDetail.jobLocCity
                                                var jobLocArea = list[i].jobLocArea
                                                var companyIndustry = list[i].companyIndustry
                                                var companyFinance = list[i].companyFinance
                                                var companyName = list[i].companyName
                                                var companyScale = list[i].companyScale
                                                var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                                                var liEle=
                                                    '<li class="licontent">'+
                                                    '  <a href="'+url1+'" class="content_a">' +' <div class="job_card">'+
                                                    ' <div class="line1">'+'   <span class="line1_span1">'+jobName+'</span>'+
                                                    ' <span class="line1_span2">'+'苏州'+jobLocArea+'</span>'+'</div>'+
                                                    '  <div class="line2">'+'    <span class="line2_span1">'+jobMinSalary+'-'+jobMaxSalary+
                                                    '   </span>'+'  <span class="line2_span2">'+jobExperience+'</span>'+
                                                    ' <span class="line2_span3">'+jobDegree+'</span>'+' </div>'+'</div>'+
                                                    ' <div class="company_card">'+' <img src="'+companyImg+'" alt="" style="width: 54px">'+

                                                    ' <a href="" class="right_line1">'+companyName+'</a>'+'   <ul class="right_line2">'+
                                                    '  <li class="right_linecontent right_line21">'+companyIndustry+'</li>'+
                                                    '<li class="right_linecontent right_line22">'+companyFinance+'</li>'+
                                                    '<li class="right_linecontent right_line23">'+companyScale+'</li>'+'  </ul>'+
                                                    ' </div>'+'<div class="content_li_footer">'+'  <div class="footer_left">'+
                                                    ' <ul class="f">'+' <li class="f1">'+jobType+'</li>'+
                                                    ' </ul>'+'</div>'+'<span class="footer_right" title="五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补">'+
                                                    '五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补'+'   </span>'+' </div>'+'  </a>'+'      </li>'

                                                $(".page1").append(liEle)
                                            }


                                        }
                                    })
                                    //首次不执行
                                    if(!first){
                                        //do something
                                    }
                                }


                            });
                        })
                    }
                })

            }else{
                load1()
            }
        })


    }

    //清空筛选
    $(".clearselect clears").click(function (){
        load1();
    })

    //登陆信息
    loadIndexData();

    function loadIndexData(){
        console.log("=====登陆信息显示======");
        var token = localStorage.getItem("token");//获得在登录界面生成的 token
        console.log("index获得的token-----:" + token);


    }



    function load(){$.ajax({
        type:"post",
        url:"${pageContext.request.contextPath}/job/getTotal",
        data:{
            jobDegree:degree,
            companyIndustry:companyde,
            salary:salaryde,
            jingyan:jingyande,
            // companyFinance:rongzide,
            companyScale:companysizede
        },
        success:function (result){
            console.log("fafasfaf:" + result);
            var allnum=result.data;
            console.log("allnum   "+allnum)



            layui.use(['laypage', 'layer'], function(){
                var laypage = layui.laypage
                    ,layer = layui.layer;
                laypage.render({
                    elem: 'demo2'
                    ,count: allnum
                    ,limit: 7
                    ,theme: '#76f5e2'
                    ,jump: function(obj, first){

                        //obj包含了当前分页的所有参数，比如：
                        console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                        console.log(obj.limit); //得到每页显示的条数
                        console.log("-----职位信息显现-----")
                        $.ajax({
                            type:"post",
                            url:"${pageContext.request.contextPath}/job/getAlls/"+obj.curr,
                            data:{
                                jobDegree:degree,
                                companyIndustry:companyde,
                                salary:salaryde,
                                jingyan:jingyande,
                                // companyFinance:rongzide,
                                companyScale:companysizede
                            },
                            success:function (result){
                                console.log("result   "+JSON.stringify(result));


                                var out=result.data;
                                var pageNum=out.pageNum
                                console.log("pageNum"+pageNum)
                                console.log("out  "+out);
                                var total=out.total
                                console.log("查询的总职位数"+total)
                                var list=out.list
                                console.log(list.length)
                                $(".page1").html("")
                                for (var i=0;i<list.length;i++) {
                                    var jobId = list[i].jobId
                                    var jobName = list[i].jobName
                                    var jobType = list[i].jobType
                                    var companyImg=list[i].companyImg
                                    var companyId = list[i].companyId
                                    var jobDegree = list[i].jobDegree
                                    var jobMaxSalary = Math.floor(list[i].jobMaxSalary)
                                    var jobExperience = list[i].jobExperience
                                    var jobMinSalary = Math.floor(list[i].jobMinSalary)
                                    // var jobLabel=jobDetail.jobLabel
                                    // var jobLocProvince=jobDetail.jobLocProvince
                                    // var jobLocCity=jobDetail.jobLocCity
                                    var jobLocArea = list[i].jobLocArea
                                    var companyIndustry = list[i].companyIndustry
                                    var companyFinance = list[i].companyFinance
                                    var companyName = list[i].companyName
                                    var companyScale = list[i].companyScale
                                    var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                                    var liEle=
                                        '<li class="licontent">'+
                                        '  <a href="'+url1+'" class="content_a">' +' <div class="job_card">'+
                                        ' <div class="line1">'+'   <span class="line1_span1">'+jobName+'</span>'+
                                        ' <span class="line1_span2">'+'苏州'+jobLocArea+'</span>'+'</div>'+
                                        '  <div class="line2">'+'    <span class="line2_span1">'+jobMinSalary+'-'+jobMaxSalary+
                                        '   </span>'+'  <span class="line2_span2">'+jobExperience+'</span>'+
                                        ' <span class="line2_span3">'+jobDegree+'</span>'+' </div>'+'</div>'+
                                        ' <div class="company_card">'+' <img src="'+companyImg+'" alt="" style="width: 54px">'+

                                        ' <a href="" class="right_line1">'+companyName+'</a>'+'   <ul class="right_line2">'+
                                        '  <li class="right_linecontent right_line21">'+companyIndustry+'</li>'+
                                        '<li class="right_linecontent right_line22">'+companyFinance+'</li>'+
                                        '<li class="right_linecontent right_line23">'+companyScale+'</li>'+'  </ul>'+
                                        ' </div>'+'<div class="content_li_footer">'+'  <div class="footer_left">'+
                                        ' <ul class="f">'+' <li class="f1">'+jobType+'</li>'+
                                        ' </ul>'+'</div>'+'<span class="footer_right" title="五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补">'+
                                        '五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补'+'   </span>'+' </div>'+'  </a>'+'      </li>'

                                    $(".page1").append(liEle)
                                }


                            }
                        })
                        //首次不执行
                        if(!first){
                            //do something
                        }
                    }


                });
            });
        }
    })}
    $(".queding").click(function (){
        var degree=degrees();
        var companyde=xiala();
        var salaryde=salarys();
        var jingyande=jingyans();
        var companysizede=companysizes();
        // var rongzide =rongzis();
        console.log("degree"+degree)
        console.log("companyde"+companyde)
        console.log("salaryde"+salaryde)
        console.log("jingyande"+jingyande)
        console.log("companysizede"+companysizede)
        // console.log("rongzide"+rongzide)
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath}/job/getTotal",
            data:{
                jobDegree:degree,
                companyIndustry:companyde,
                salary:salaryde,
                jingyan:jingyande,
                // companyFinance:rongzide,
                companyScale:companysizede
            },
            success:function (result){
                console.log("fafasfaf:" + result);
                var allnum=result.data;
                console.log("allnum   "+allnum)



                layui.use(['laypage', 'layer'], function(){
                    var laypage = layui.laypage
                        ,layer = layui.layer;
                    laypage.render({
                        elem: 'demo2'
                        ,count: allnum
                        ,limit: 7
                        ,theme: '#76f5e2'
                        ,jump: function(obj, first){

                            //obj包含了当前分页的所有参数，比如：
                            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                            console.log(obj.limit); //得到每页显示的条数
                            console.log("-----职位信息显现-----")
                            $.ajax({
                                type:"post",
                                url:"${pageContext.request.contextPath}/job/getAlls/"+obj.curr,
                                data:{
                                    jobDegree:degree,
                                    companyIndustry:companyde,
                                    salary:salaryde,
                                    jingyan:jingyande,
                                    // companyFinance:rongzide,
                                    companyScale:companysizede
                                },
                                success:function (result){
                                    console.log("result   "+JSON.stringify(result));


                                    var out=result.data;
                                    var pageNum=out.pageNum
                                    console.log("pageNum"+pageNum)
                                    console.log("out  "+out);
                                    var total=out.total
                                    console.log("查询的总职位数"+total)
                                    var list=out.list
                                    console.log(list.length)
                                    $(".page1").html("")
                                    for (var i=0;i<list.length;i++) {
                                        var jobId = list[i].jobId
                                        var jobName = list[i].jobName
                                        var jobType = list[i].jobType
                                        var companyImg=list[i].companyImg
                                        var companyId = list[i].companyId
                                        var jobDegree = list[i].jobDegree
                                        var jobMaxSalary = Math.floor(list[i].jobMaxSalary)
                                        var jobExperience = list[i].jobExperience
                                        var jobMinSalary = Math.floor(list[i].jobMinSalary)
                                        // var jobLabel=jobDetail.jobLabel
                                        // var jobLocProvince=jobDetail.jobLocProvince
                                        // var jobLocCity=jobDetail.jobLocCity
                                        var jobLocArea = list[i].jobLocArea
                                        var companyIndustry = list[i].companyIndustry
                                        var companyFinance = list[i].companyFinance
                                        var companyName = list[i].companyName
                                        var companyScale = list[i].companyScale
                                        var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                                        var liEle=
                                            '<li class="licontent">'+
                                            '  <a href="'+url1+'" class="content_a">' +' <div class="job_card">'+
                                            ' <div class="line1">'+'   <span class="line1_span1">'+jobName+'</span>'+
                                            ' <span class="line1_span2">'+'苏州'+jobLocArea+'</span>'+'</div>'+
                                            '  <div class="line2">'+'    <span class="line2_span1">'+jobMinSalary+'-'+jobMaxSalary+
                                            '   </span>'+'  <span class="line2_span2">'+jobExperience+'</span>'+
                                            ' <span class="line2_span3">'+jobDegree+'</span>'+' </div>'+'</div>'+
                                            ' <div class="company_card">'+' <img src="'+companyImg+'" alt="" style="width: 54px">'+

                                            ' <a href="" class="right_line1">'+companyName+'</a>'+'   <ul class="right_line2">'+
                                            '  <li class="right_linecontent right_line21">'+companyIndustry+'</li>'+
                                            '<li class="right_linecontent right_line22">'+companyFinance+'</li>'+
                                            '<li class="right_linecontent right_line23">'+companyScale+'</li>'+'  </ul>'+
                                            ' </div>'+'<div class="content_li_footer">'+'  <div class="footer_left">'+
                                            ' <ul class="f">'+' <li class="f1">'+jobType+'</li>'+
                                            ' </ul>'+'</div>'+'<span class="footer_right" title="五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补">'+
                                            '五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补'+'   </span>'+' </div>'+'  </a>'+'      </li>'

                                        $(".page1").append(liEle)
                                    }


                                }
                            })
                            //首次不执行
                            if(!first){
                                //do something
                            }
                        }


                    });
                });
            }
        })
    })
    function load1(){
        $.ajax({
            type:"get",
            url:"${pageContext.request.contextPath}/job/getTotals",
            success:function (result){
                var allnum=result.data;
                console.log("allnum   "+allnum)


                layui.use(['laypage', 'layer'], function(){
                    var laypage = layui.laypage
                        ,layer = layui.layer;
                    laypage.render({
                        elem: 'demo2'
                        ,count: allnum
                        ,limit: 7
                        ,theme: '#76f5e2'
                        ,jump: function(obj, first){

                            //obj包含了当前分页的所有参数，比如：
                            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                            console.log(obj.limit); //得到每页显示的条数
                            console.log("-----职位信息显现-----")
                            $.ajax({
                                type:"get",
                                url:"${pageContext.request.contextPath}/job/getAll/"+obj.curr,

                                success:function (result){
                                    console.log("result   "+result)


                                    var out=result.data;
                                    var pageNum=out.pageNum
                                    console.log("pageNum"+pageNum)
                                    console.log("out  "+out);
                                    var total=out.total
                                    console.log("查询的总职位数"+total)
                                    var list=out.list
                                    console.log(list.length)
                                    $(".page1").html("")
                                    for (var i=0;i<list.length;i++) {

                                        var jobId = list[i].jobId
                                        var jobName = list[i].jobName
                                        var jobType = list[i].jobType
                                        var companyImg=list[i].companyImg
                                        var companyId = list[i].companyId
                                        var jobDegree = list[i].jobDegree
                                        var jobMaxSalary = Math.floor(list[i].jobMaxSalary)
                                        var jobExperience = list[i].jobExperience
                                        var jobMinSalary = Math.floor(list[i].jobMinSalary)
                                        // var jobLabel=jobDetail.jobLabel
                                        // var jobLocProvince=jobDetail.jobLocProvince
                                        // var jobLocCity=jobDetail.jobLocCity
                                        var jobLocArea = list[i].jobLocArea
                                        var companyIndustry = list[i].companyIndustry
                                        var companyFinance = list[i].companyFinance
                                        var companyName = list[i].companyName
                                        var companyScale = list[i].companyScale
                                        var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                                        var liEle=
                                            '<li class="licontent">'+
                                            '  <a href="'+url1+'" class="content_a">' +' <div class="job_card">'+
                                            ' <div class="line1">'+'   <span class="line1_span1">'+jobName+'</span>'+
                                            ' <span class="line1_span2">'+'苏州'+jobLocArea+'</span>'+'</div>'+
                                            '  <div class="line2">'+'    <span class="line2_span1">'+jobMinSalary+'-'+jobMaxSalary+
                                            '   </span>'+'  <span class="line2_span2">'+jobExperience+'</span>'+
                                            ' <span class="line2_span3">'+jobDegree+'</span>'+' </div>'+'</div>'+
                                            ' <div class="company_card">'+' <img src="'+companyImg+'" alt="" style="width: 54px">'+

                                            ' <a href="" class="right_line1">'+companyName+'</a>'+'   <ul class="right_line2">'+
                                            '  <li class="right_linecontent right_line21">'+companyIndustry+'</li>'+
                                            '<li class="right_linecontent right_line22">'+companyFinance+'</li>'+
                                            '<li class="right_linecontent right_line23">'+companyScale+'</li>'+'  </ul>'+
                                            ' </div>'+'<div class="content_li_footer">'+'  <div class="footer_left">'+
                                            ' <ul class="f">'+' <li class="f1">'+jobType+'</li>'+
                                            ' </ul>'+'</div>'+'<span class="footer_right" title="五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补">'+
                                            '五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补'+'   </span>'+' </div>'+'  </a>'+'      </li>'

                                        $(".page1").append(liEle)
                                    }


                                }
                            })
                            //首次不执行
                            if(!first){
                                //do something
                            }
                        }


                    });
                });
            }
        })

    }

    var kw=sessionStorage.getItem("kw")
    loadselect(kw);
    function loadselect(kw){
        var url ;
        if (kw == null || kw == "") {
            //  没有条件查询所有的

            load1()
        } else {
            // 有条件的查询
            url ="${pageContext.request.contextPath}/getHighByJobComany/"+kw+"/";

            console.log(">>>>>>>>>>>>>>>>>>>>>url =" + url)


            $.ajax({
                type:"get",
                url:"${pageContext.request.contextPath}/job/getTotals",
                success:function (result){

                    var allnum=result.data;
                    console.log("allnum   "+allnum)


                    layui.use(['laypage', 'layer'], function(){
                        var laypage = layui.laypage
                            ,layer = layui.layer;
                        laypage.render({
                            elem: 'demo2'
                            ,count: allnum
                            ,limit: 7
                            ,theme: '#76f5e2'
                            ,jump: function(obj, first){

                                //obj包含了当前分页的所有参数，比如：
                                console.log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                                console.log(obj.limit); //得到每页显示的条数
                                console.log("-----职位信息显现-----")
                                // var ipage=obj.curr
                                console.log("----------11111111111----------url:"+url)
                                $.ajax({
                                    type:"get",
                                    url:url+obj.curr,

                                    success:function (result){
                                        console.log("-----------result result ....-----------")
                                        console.log(result)

                                        var list=result.esJobCompany
                                        console.log("***********************************************"+list.length)
                                        for (var i=0;i<list.length;i++){
                                            var jobName=list[i].jobName
                                            console.log("----------------------22222222222222222222-------------------------------"+jobName)
                                        }
                                        // var out=result.data;
                                        // var pageNum=out.pageNum
                                        // console.log("pageNum"+pageNum)
                                        // console.log("out  "+out);
                                        // var total=out.total
                                        // console.log("查询的总职位数"+total)
                                        // var list=out.list
                                        //console.log(list.length)
                                        $(".page1").html("")
                                        for (var i=0;i<list.length;i++) {

                                            var jobId = list[i].jobId
                                            var jobName = list[i].jobName
                                            var jobType = list[i].jobType
                                            var companyImg=list[i].companyImg
                                            var companyId = list[i].companyId
                                            var jobDegree = list[i].jobDegree
                                            var jobMaxSalary = Math.floor(list[i].jobMaxSalary)
                                            var jobExperience = list[i].jobExperience
                                            var jobMinSalary = Math.floor(list[i].jobMinSalary)
                                            // var jobLabel=jobDetail.jobLabel
                                            // var jobLocProvince=jobDetail.jobLocProvince
                                            // var jobLocCity=jobDetail.jobLocCity
                                            var jobLocArea = list[i].jobLocArea
                                            var companyIndustry = list[i].companyIndustry
                                            var companyFinance = list[i].companyFinance
                                            var companyName = list[i].companyName
                                            var companyScale = list[i].companyScale
                                            var url1="/link/job/getById/"+jobId
                                            var liEle=
                                                '<li class="licontent">'+
                                                '  <a href="'+url1+'" class="content_a">' +' <div class="job_card">'+
                                                ' <div class="line1">'+'   <span class="line1_span1">'+jobName+'</span>'+
                                                ' <span class="line1_span2">'+'苏州'+jobLocArea+'</span>'+'</div>'+
                                                '  <div class="line2">'+'    <span class="line2_span1">'+jobMinSalary+'-'+jobMaxSalary+
                                                '   </span>'+'  <span class="line2_span2">'+jobExperience+'</span>'+
                                                ' <span class="line2_span3">'+jobDegree+'</span>'+' </div>'+'</div>'+
                                                ' <div class="company_card">'+' <img src="'+companyImg+'" alt="" style="width: 54px">'+

                                                ' <a href="" class="right_line1">'+companyName+'</a>'+'   <ul class="right_line2">'+
                                                '  <li class="right_linecontent right_line21">'+companyIndustry+'</li>'+
                                                '<li class="right_linecontent right_line22">'+companyFinance+'</li>'+
                                                '<li class="right_linecontent right_line23">'+companyScale+'</li>'+'  </ul>'+
                                                ' </div>'+'<div class="content_li_footer">'+'  <div class="footer_left">'+
                                                ' <ul class="f">'+' <li class="f1">'+jobType+'</li>'+
                                                ' </ul>'+'</div>'+'<span class="footer_right" title="五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补">'+
                                                '五险一金，定期体检，员工旅游，节日福利，带薪年假，年终奖，通讯补贴，餐补'+'   </span>'+' </div>'+'  </a>'+'      </li>'

                                            $(".page1").append(liEle)
                                        }


                                    }
                                })
                                //首次不执行
                                if(!first){
                                    //do something
                                }
                            }


                        });
                    });
                }
            })
            sessionStorage.removeItem("kw")
        }
    }

    // var text=$(".content_a").attr('href')
    // var jobId=text.slice(-4)
    // console.log("--------------------ssssssssssssssssssssssssss--------------------------------"+jobId)

    //浏览记录
    var token=localStorage.getItem("token")
    console.log("未登录token："+token)
    if (token==null || token=="null"){
        $(".otherlookword").text("看一看")
        console.log("55555555555555555555555555555555555555555555555555555555555555555555555555555555")
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath}/job/getJobCom",
            data:{size:5},
            success:function (result){
                var list=result.data
                for (var i=0;i<list.length;i++) {
                    var jobName = list[i].jobName
                    var jobMinSalary = list[i].jobMinSalary
                    var jobMaxSalary = list[i].jobMaxSalary
                    var companyName = list[i].companyName
                    var jobLocArea = list[i].jobLocArea
                    var jobId=list[i].jobId
                    var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                    var ele = ' <li class="boxcontent">' + ' <a href="'+url1+'" class="boxcon">'+'<div class="otherlookbox1">'+
                        ' <span class="otherbox1_left">'+jobName+'（五险一金，不加班）'+'</span>'+'   <span class="otherbox1_right">'+
                        jobMinSalary+'-'+jobMaxSalary+'</span>'+'</div>'+'<div class="otherlookbox2">'+'<span class="otherbox2_left">'+
                        companyName+'</span>'+'  <span class="otherbox2_right">'+'苏州·'+jobLocArea+'</span>'+
                        ' </div>'+'  </a>'+'   </li>'
                    $(".otherlookbox").append(ele)
                }
            }
        })

    }
    else{

        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath}/job/getCookie",
            data:{token:token},
            success:function (result){
                var list=result.data;

                console.log("11111111111111111111111111111111111111111111111111111111111111111111111111"+list.length)
                $(".otherlookbox").html("")
                if (list.length!=0){
                    if (list.length==5){
                        for (var i=0;i<list.length;i++) {
                            var jobName = list[i].jobName
                            var jobMinSalary = list[i].jobMinSalary
                            var jobMaxSalary = list[i].jobMaxSalary
                            var companyName = list[i].companyName
                            var jobLocArea = list[i].jobLocArea
                            var jobId=list[i].jobId
                            var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                            var ele = ' <li class="boxcontent">' + ' <a href="'+url1+'" class="boxcon">'+'<div class="otherlookbox1">'+
                                ' <span class="otherbox1_left">'+jobName+'（五险一金，不加班）'+'</span>'+'   <span class="otherbox1_right">'+
                                jobMinSalary+'-'+jobMaxSalary+'</span>'+'</div>'+'<div class="otherlookbox2">'+'<span class="otherbox2_left">'+
                                companyName+'</span>'+'  <span class="otherbox2_right">'+'苏州·'+jobLocArea+'</span>'+
                                ' </div>'+'  </a>'+'   </li>'
                            $(".otherlookbox").append(ele)
                        }
                    }
                    else{
                        var size=5-list.length
                        for (var i=0;i<list.length;i++) {
                            var jobName = list[i].jobName
                            var jobMinSalary = list[i].jobMinSalary
                            var jobMaxSalary = list[i].jobMaxSalary
                            var companyName = list[i].companyName
                            var jobLocArea = list[i].jobLocArea
                            var jobId=list[i].jobId
                            var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                            var ele = ' <li class="boxcontent">' + ' <a href="'+url1+'" class="boxcon">'+'<div class="otherlookbox1">'+
                                ' <span class="otherbox1_left">'+jobName+'（五险一金，不加班）'+'</span>'+'   <span class="otherbox1_right">'+
                                jobMinSalary+'-'+jobMaxSalary+'</span>'+'</div>'+'<div class="otherlookbox2">'+'<span class="otherbox2_left">'+
                                companyName+'</span>'+'  <span class="otherbox2_right">'+'苏州·'+jobLocArea+'</span>'+
                                ' </div>'+'  </a>'+'   </li>'
                            $(".otherlookbox").append(ele)
                        }
                        $.ajax({
                            type:"post",
                            url:"${pageContext.request.contextPath}/job/getJobCom",
                            data:{size:size},
                            success:function (result){
                                var list=result.data
                                for (var i=0;i<list.length;i++) {
                                    var jobName = list[i].jobName
                                    var jobMinSalary = list[i].jobMinSalary
                                    var jobMaxSalary = list[i].jobMaxSalary
                                    var companyName = list[i].companyName
                                    var jobLocArea = list[i].jobLocArea
                                    var jobId=list[i].jobId
                                    var url1="${pageContext.request.contextPath}/job/getById/"+jobId
                                    var ele = ' <li class="boxcontent">' + ' <a href="'+url1+'" class="boxcon">'+'<div class="otherlookbox1">'+
                                        ' <span class="otherbox1_left">'+jobName+'（五险一金，不加班）'+'</span>'+'   <span class="otherbox1_right">'+
                                        jobMinSalary+'-'+jobMaxSalary+'</span>'+'</div>'+'<div class="otherlookbox2">'+'<span class="otherbox2_left">'+
                                        companyName+'</span>'+'  <span class="otherbox2_right">'+'苏州·'+jobLocArea+'</span>'+
                                        ' </div>'+'  </a>'+'   </li>'
                                    $(".otherlookbox").append(ele)
                                }
                            }
                        })
                    }
                }


            }

        })
    }

</script>
</body>
</html>
